﻿using System;

namespace Notoric.Commanding.Holders
{
    /// <summary>
    /// An exception that is thrown when the value of a value holder is queried while it is not known (see <see cref="F:Notoric.Commanding.Holders.ValueState.Unknown"/>).
    /// </summary>
    /// <seealso cref="IValueHolder"/>
    /// <seealso cref="P:Notoric.Commanding.Holders.IValueHolder.ValueState"/>
    /// <seealso cref="ValueState"/>
    [global::System.Serializable]
    public class ValueNotKnownException : Exception
    {
        /// <summary>
        /// Creates a new <see cref="ValueNotKnownException"/> instance.
        /// </summary>
        public ValueNotKnownException() { }
        /// <summary>
        /// Creates a new <see cref="ValueNotKnownException"/> instance.
        /// </summary>
        /// <param name="message">The message that describes the error.</param>
        public ValueNotKnownException(string message) : base(message) { }
        /// <summary>
        /// Creates a new <see cref="ValueNotKnownException"/> instance.
        /// </summary>
        /// <param name="message">The message that describes the error.</param>
        /// <param name="inner">The exception that is the cause of the current exception, or <see langword="null"/> if no inner exception is specified.</param>
        public ValueNotKnownException(string message, Exception inner) : base(message, inner) { }
        /// <summary>
        /// Creates a new <see cref="ValueNotKnownException"/> instance.
        /// </summary>
        /// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
        /// <param name="context">The <see cref="System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
        protected ValueNotKnownException(
          System.Runtime.Serialization.SerializationInfo info,
          System.Runtime.Serialization.StreamingContext context)
            : base(info, context) { }
    }
}
